"use strict";
const { app, BrowserWindow } = require("electron");
require("path");
const createWindow = () => {
  const mainWindow = new BrowserWindow({
    width: 1024,
    height: 768,
    transparent: true,
    frame: true,
    // 可选，隐藏窗口边框
    title: "贪吃蛇",
    // 应用标题
    webPreferences: {
      nodeIntegration: true
    }
  });
  mainWindow.loadURL(process.env.VITE_DEV_SERVER_URL);
};
app.whenReady().then(() => {
  createWindow();
  app.on("activate", () => {
    if (BrowserWindow.getAllWindows().length === 0) createWindow();
  });
});
app.on("request-data", (event) => {
  event.reply("response-data", { key: "value" });
});
app.on("window-all-closed", () => {
  if (process.platform !== "darwin") app.quit();
});
